package com.tongji.diy
{
	
	import com.tongji.diy.controller.AddFurnitureCommand;
	import com.tongji.diy.controller.AddShapeCommand;
	import com.tongji.diy.controller.FurnitureFinalStateCommand;
	import com.tongji.diy.controller.FurnitureMaunalRotationCommand;
	import com.tongji.diy.controller.FurnitureRotationCommand;
	import com.tongji.diy.controller.LockFurnitureCommand;
	import com.tongji.diy.controller.ReturnDoors;
	import com.tongji.diy.controller.RoomRotationCommand;
	import com.tongji.diy.controller.TestEnterClickCommand;
	import com.tongji.diy.controller.UploadHoleCommand;
	import com.tongji.diy.controller.UploadRoomBorderCommand;
	import com.tongji.diy.controller.UploadRoomPositionCommand;
	import com.tongji.diy.controller.UploadRoomRotationCommand;
	import com.tongji.diy.controller.UploadRoomVertexCommand;
	import com.tongji.diy.controller.furnitureOptimizationController.FurnitureOptimizationClickCommand;
	import com.tongji.diy.controller.furnitureOptimizationController.IterationCallbackCommand;
	import com.tongji.diy.controller.furnitureOptimizationController.OptimizationAddFurnitureCommand;
	import com.tongji.diy.controller.furnitureOptimizationController.StartIntegrateCommand;
	import com.tongji.diy.event.AddNewFurnitureEvent;
	import com.tongji.diy.event.AddShapeEvent;
	import com.tongji.diy.event.FurnitureFinalStateEvent;
	import com.tongji.diy.event.FurnitureManualRotationEvent;
	import com.tongji.diy.event.FurnitureRotationEvent;
	import com.tongji.diy.event.LockFurnitureEvent;
	import com.tongji.diy.event.ReturnDoorsInfoEvent;
	import com.tongji.diy.event.RoomRotationEvent;
	import com.tongji.diy.event.TestEnterClickEvent;
	import com.tongji.diy.event.UploadHoleEvent;
	import com.tongji.diy.event.UploadRoomBorderEvent;
	import com.tongji.diy.event.UploadRoomPositionEvent;
	import com.tongji.diy.event.UploadRoomRotationEvent;
	import com.tongji.diy.event.UploadRoomVertexEvent;
	import com.tongji.diy.event.furnitureOptimizationEvent.FurnitureOptimizationClickEvent;
	import com.tongji.diy.event.furnitureOptimizationEvent.IterationCallbackEvent;
	import com.tongji.diy.event.furnitureOptimizationEvent.OptimizationAddFurnitureEvent;
	import com.tongji.diy.event.furnitureOptimizationEvent.StartIntegrateEvent;
	import com.tongji.diy.model.DoorsAndWindows;
	import com.tongji.diy.model.FurnitureModel;
	import com.tongji.diy.model.RoomBorderChildModel;
	import com.tongji.diy.model.RoomChildModel;
	import com.tongji.diy.model.RoomDataModel;
	import com.tongji.diy.model.furniturePlacementOptimization.AssembleModel;
	import com.tongji.diy.model.furniturePlacementOptimization.FurnitureOptimizationModel;
	import com.tongji.diy.model.furniturePlacementOptimization.IntegrateModel;
	import com.tongji.diy.view.GoodsItemRenterer;
	import com.tongji.diy.view.GoodsItemRentererMediator;
	import com.tongji.diy.view.MainScene;
	import com.tongji.diy.view.MainSceneMediator;
	import com.tongji.diy.view.RoomBorderChildPanel;
	import com.tongji.diy.view.RoomBorderChildPanelMediator;
	import com.tongji.diy.view.RoomChildPanel;
	import com.tongji.diy.view.RoomChildPanelMediator;
	import com.tongji.diy.view.ScrollingRoomContent;
	import com.tongji.diy.view.ScrollingRoomMediator;
	import com.tongji.diy.view.ScrollingWallContent;
	import com.tongji.diy.view.ScrollingWallMediator;
	
	import flash.display.DisplayObjectContainer;
	
	import mx.core.InteractionMode;
	
	import org.robotlegs.mvcs.Context;
	
	/**
	 * 
	 * @author xxj
	 * 
	 */
	
	public class DiyContext extends Context
	{
		public function DiyContext(contextView:DisplayObjectContainer=null, autoStartup:Boolean=true)
		{
			super(contextView, autoStartup);
		}
		
		override public function startup():void
		{			
			//mapModel
			injector.mapSingleton(RoomDataModel);
			injector.mapSingleton(RoomChildModel);
			injector.mapSingleton(RoomBorderChildModel);
			injector.mapSingleton(FurnitureModel);
			injector.mapSingleton(FurnitureOptimizationModel);
			injector.mapSingleton(AssembleModel);
			injector.mapSingleton(IntegrateModel);
			injector.mapSingleton(DoorsAndWindows);
			
			//mapView
			mediatorMap.mapView(GoodsItemRenterer, GoodsItemRentererMediator);
			mediatorMap.mapView(RoomChildPanel, RoomChildPanelMediator);
			mediatorMap.mapView(RoomBorderChildPanel, RoomBorderChildPanelMediator);
			mediatorMap.mapView(ScrollingRoomContent, ScrollingRoomMediator);
			mediatorMap.mapView(ScrollingWallContent, ScrollingWallMediator);
			mediatorMap.mapView(MainScene, MainSceneMediator);
			mediatorMap.mapView(Diy, DiyMediator);
			
			//mapView
			commandMap.mapEvent(UploadRoomPositionEvent.UPLOAD_ROOM_POSITION, UploadRoomPositionCommand);
			commandMap.mapEvent(UploadRoomRotationEvent.UPLOAD_ROOM_ROTATION, UploadRoomRotationCommand);
			commandMap.mapEvent(UploadRoomVertexEvent.UPLOAD_ROOM_VERTEX, UploadRoomVertexCommand);
			commandMap.mapEvent(UploadRoomBorderEvent.UPLOAD_ROOM_BORDER, UploadRoomBorderCommand);
			commandMap.mapEvent(AddShapeEvent.ADD_SHAPE, AddShapeCommand);
			commandMap.mapEvent(UploadHoleEvent.UPLOAD_HOLE, UploadHoleCommand);
			commandMap.mapEvent(RoomRotationEvent.ROOM_ROTATION_CLOCKWISE, RoomRotationCommand);
			commandMap.mapEvent(RoomRotationEvent.ROOM_ROTATION_COUNTERCLOCKWISE, RoomRotationCommand);
			commandMap.mapEvent(FurnitureRotationEvent.FURNITURE_ROTATION, FurnitureRotationCommand);
			commandMap.mapEvent(AddNewFurnitureEvent.ADD_NEW_FURNITURE, AddFurnitureCommand);
			commandMap.mapEvent(LockFurnitureEvent.LOCK_FURNITURE, LockFurnitureCommand);
			commandMap.mapEvent(FurnitureFinalStateEvent.FINAL_POSITION, FurnitureFinalStateCommand);
			commandMap.mapEvent(FurnitureManualRotationEvent.FURNITURE_ROTATION_CLOCKWISE, FurnitureMaunalRotationCommand);
			commandMap.mapEvent(FurnitureManualRotationEvent.FURNITURE_ROTATION_COUNTERCLOCKWISE, FurnitureMaunalRotationCommand);
			commandMap.mapEvent(FurnitureOptimizationClickEvent.FURNITURE_OPTIMIZATION, FurnitureOptimizationClickCommand);
			commandMap.mapEvent(OptimizationAddFurnitureEvent.OPTIMIZATION_ADD_FURNITURE, OptimizationAddFurnitureCommand);
			commandMap.mapEvent(StartIntegrateEvent.STAR_INTEGRATE, StartIntegrateCommand);
			commandMap.mapEvent(ReturnDoorsInfoEvent.RETURNDOOSINFO, ReturnDoors);
			//testCommand
			commandMap.mapEvent(FurnitureOptimizationClickEvent.FURNITURE_OPTIMIZATION_FRAGMENT_SHOW, FurnitureOptimizationClickCommand);
			commandMap.mapEvent(IterationCallbackEvent.CALL_BACK, IterationCallbackCommand);
			commandMap.mapEvent(TestEnterClickEvent.ENTER_CLICK, TestEnterClickCommand);
			
		}
	}
	
}